package br.dcc.ufmg.persistence;

import java.sql.ResultSet;

import br.dcc.ufmg.domain.Method;

public class MethodsDAO extends ArtifactDAO<Method>{
	
	public String buildSqlArtifactsMeasures(String sources, Method method,
			String metric) {
		StringBuilder sqlBuilder = new StringBuilder(
				"SELECT metric_id, value FROM measure WHERE "
						+ " metric_id = '" + metric + "' ");
		sqlBuilder.append(" AND name = '").append(method.getName())
				.append("' and source = '")
				.append(method.getClass_().getSource())
				.append("' and package = '")
				.append(method.getClass_().getPackage_().getName())
				.append("';");
		return sqlBuilder.toString();
	}

	@Override
	protected String getStringType() {
		// TODO Auto-generated method stub
		return "method";
	}

	@Override
	protected Method createArtifactFromResultSet(ResultSet rs) throws Exception {
		// TODO Auto-generated method stub
		return Method.createMethod(rs);
	}
	
	
}
